package day5;

import java.awt.print.Pageable;

/**
 * @author oldliu
 * @since 1.0
 */
public class Student {
    private String name;
    private String zhanye;
    private int age;
    //三门课成绩
    private float java;
    private float sql;
    private float csharp;
    public Student(){

    }
    public Student(String n, int a, float j, float s, float c){
        name=n;

        //age=a;
        setAge(a);//!!!
        java=j;
        sql=s;
        csharp=c;
    }
    private Student(float j, float s, float c){
        java=j;
        sql=s;
        csharp=c;
    }
    //初始化java和sql的成绩
    public Student(float java, float sql){
        //this.java=java;
        //this.sql=sql;
        this(java,sql,0);
        this.show();//调用本对象的方法
    }
    //错误
    //初始化java和C#的成绩
//    public Student(float j,float c){
//        java=j;
//        csharp=c;
//    }

    //读名字
    public String getName(){
        return name;
    }
    //改名字
    public void setName(String n){
        this.name=n;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age>120||age<1) {
            System.out.println("年龄"+age+"设置错误");
            return;
        }
        this.age = age;
    }

    public float getJava() {
        return java;
    }

    public void setJava(float java) {
        this.java = java;
    }

    public float getSql() {
        return sql;
    }

    public void setSql(float sql) {
        this.sql = sql;
    }

    public float getCsharp() {
        return csharp;
    }

    public void setCsharp(float csharp) {
        this.csharp = csharp;
    }

    public void show(){
        System.out.println("学生"+name+",年龄是"+age+"成绩如下:");
        System.out.println("java:"+java+",sql："+sql+",c#:"+csharp);
    }
    private void show2(){
        System.out.println("学生"+name+",年龄是"+age);

    }
}
